perm filename HAND.WRU[SYS,HE] blob sn#166315 filedate 1972-06-01 generic text, type T, neo UTF8
00100	%TOP,,HAND-EYE SYSTEM PART I,  ,1-1
00200	 
00300	
00400	
00500	
00600	
00700	
00800	
00900	
01000	
01100	
01200	
01300	
01400	
01500	
01600			SYSTEM MANUAL FOR HAND-EYE HACKERS
01700	
01800			PART I.				[HAND.WRU]
01900				SECTION 1. OVERALL VIEW OF SYSTEM
02000				SECTION 2. THE GLOBAL MODEL
02100				SECTION 3. SAILX
02200				SECTION 4. LOADING
02300			PART II.  MESSAGE PROCEDURES	[MESSAG.WRU]
02400			PART III. MONITOR		[MONITR.WRU]
     

00100	1.0  OVERALL VIEW OF SYSTEM
00200	
00300	
00400	This writeup attempts to cover the system  aspects  of  the  hand-eye
00500	system.   This  includes  a  brief  description  of the philosophy of
00600	organization of the system, the use of  the  global  and  local  data
00700	storage area, the message passing mechanisms, the teletype controller
00800	for talking to the user (sic), and  the  pseudo-interactive  copy  of
00900	SAIL.   If  there  is  any  money  left  after  that,  there may be a
01000	description of how to start up this hairy mess.
01100	
01200	The hand-eye system will consist of a group of jobs (jobs used in the
01300	sense  of the PDP-10 timesharing system) which are all constrained to
01400	some  particular   conventions.    These   conventions  will   enable
01500	communication  of  data  and control information among the jobs.  For
01600	the purposes of clarity, these separate jobs will be referred  to  as
01700	modules.   Each  one represents a logical and physical section of the
01800	hand-eye system.
01900	
02000	All of these modules will be run as pseudo-teletype  jobs  under  the
02100	timesharing  system.  The user will be provided with a TTY controller
02200	which is responsible for communicating with the  various  modules  in
02300	the system.  The TTY controller allows commands to be passed to these
02400	modules, and allows output from the modules to be shown to the user.
02500	
02600	The pseudo-teletype mechanism is used for controlling the modules for
02700	the  purposes  of the time-sharing system (e.g. logging in, executing
02800	system commands such as RUN DSK GILX, etc.).  This is not a practical
02900	way  of communicating large quantities of data. Another mechanism has
03000	been provided for making  data  available  to  all  modules  and  for
03100	communicating  data between modules.  This mechanism makes use of the
03200	second segment on the PDP-10.  All modules will share a common second
03300	segment  which will contain the SAIL runtime routines and global data
03400	storage space.  Almost all kinds of data may be stored in the  global
03500	area  (or  global  model),  and these may be accessed in a simple way
03600	from SAIL code (see description below).
03700	
03800	Since the second segment is common to all modules, we may also use it
03900	for passing information from one module to another.  This information
04000	is passed in the form of "messages", which  resemble  SAIL  procedure
04100	calls.   Messages provide a means for passing data and for requesting
04200	execution of so-called "message procedures" in the  various  modules.
04300	This provides a fairly convenient way of controlling the execution of
04400	several modules (see section below).
04500	
04600	Last but not least will be a special copy of SAIL which  is  able  to
04700	compile  and  execute code directly from user input (no loading phase
04800	required).  This will allow the  user  to  sit  at  the  console  and
04900	compose  little  (or  even  not  so  little)  driver programs for the
05000	functions already loaded into the various modules.  This copy of SAIL
05100	will  "know"  the names of the components of the hand-eye system, the
05200	global model, etc.
     

00100	2.0  THE GLOBAL MODEL
00200	
00300	The hand-eye system will comprise several distinct jobs,  or  modules
00301	all  running  independently  for  the  purposes  of  the time-sharing
00302	system.   However, these modules will actually be  about  one  common
00303	task,  and  will  be  able  to  communicate.    This communication is
00304	implemented in two ways -- a global data space located  in  a  second
00305	segment  shared  by  all  the  hand-eye  modules,  and a facility for
00306	passing messages between modules (see 2 below).
00307	
00308	All hand-eye modules have access to all the data stored in the global
00309	area.   The  declarations  for  global  data  are  all  included in a
00310	declaration tape that precedes the SAIL compilation of  each  module.
00311	This  insures  that space is allocated such that each separate module
00312	knows the same name for a give piece of global  data  (thus  avoiding
00313	the FORTRAN COMMON problem).
00314	
00315	The contents of the declaration tape will be arrived at by agreement,
00316	and will precede each SAIL compilation which will be loaded  as  part
00317	of the hand-eye system. This definition tape is called PREAMB.SAI and
00318	is stored on [II,HE]. It has a version number in the  first  line  of
00319	the  file and all jobs linked to a given second segment must have the
00320	same version number. If two files in  the  same  job  have  different
00321	versions, the SAIL initialization code will tell you when the program
00322	is  started.   The   message   procedure   initialization   (PUT_DATA
00323	(0,0,string))  checks  version  numbers  and  tells you if there is a
00324	mismatch.  Anyone changing PREAMB must increment the version number
02200	
02300	The  declaration and use of arithmetic data are very simple. The fact
02400	that a variable is a global is of no consequence when the user writes
02500	an arithmetic declaration:
02600	
02700	GLOBAL INTEGER A,B;
02800	GLOBAL REAL ARRAY POINTS[1:22];
02900	GLOBAL REAL CAMERAX,CAMERAY;
03000	GLOBAL SET LOSERS,WINNERS;
03100	
03200	These declarations would be included in the hand-eye definition tape.
03300	
03400	CAMERAX ← FIND_CAMERA (A,POINTS);
03500	POINTS [12]← CAMERAY;
03600	
03700	Notice that use of global variables in expressions is very natural.
03800	
03900	The  constructs  for  global  leap  operations  are  a  little   more
04000	sophisitcated.  The  declarations  for  global  leap types look quite
04100	similar to their local counterparts:
04200	
04300	GLOBAL INTEGER ITEM TABLE,CAMERA_TOP;
04400	GLOBAL ITEM FACE,BODY;
04500	GLOBAL INTEGER ARRAY ITEM POINTS [1:512];
04600	
04700	These   declarations  allocate  "global  items".   Global  items  are
04800	distinguishable from local items.  The user  may  have  2  places  to
04900	store  associations  (referred  to  as "associative stores"): a local
05000	associative store, and the  global  associative  store.  Associations
05100	stored  in  the  GAS  are  accessible  to everyone. Their function is
05200	determined by convention among  the  hand-eye  programmers  (see  the
05300	global definition tape).  The individual module may also have an LAS,
05400	in which he may store any associations he chooses.
05500	
05600	The distinction between associative stores  requires  that  the  user
05700	specify exactly which store he is referencing WHEN HE IS ACCESSING AN
05800	ASSOCIATIVE STORE (i.e. NOT when manipulating sets). Thus  we  invent
05900	constructs such as GLOBAL MAKE, GLOBAL ERASE, and GLOBAL NEW , etc.
06000	
06100	There  are  also  two  DATUM  stores, a local datum store (LDS) and a
06200	global datum store (GDS).  Again, the user must specify  which  datum
06300	he  has  in  mind when he references a datum. The constructs invented
06400	are GLOBAL DATUM (x).
06500	
06600	But, you may ask, can't the LEAP routines discover whether  the  item
06700	was declared GLOBAL, and then reference the corresponding associative
06800	or datum store?  The answer is no.   The  LAS  and  LDS  (i.e.  local
06900	stores)  MAY INDEED CONTAIN REFERENCES TO GLOBAL ITEMS.  That is, the
07000	user may write:
07100	
07200		GLOBAL ITEM FACE,BODY,MINE;
07300		ITEMVAR X,Y;
07400		ITEM HIM;  COMMENT THESE ARE LOCAL ITEMS;
07500	
07600		GLOBAL MAKE FACE⊗BODY≡MINE;
07700			COMMENT THIS IS A GAS MAKE;
07800	
07900		MAKE FACE⊗BODY≡HIS;
08000			COMMENT THIS IS AN LAS MAKE;
08100	
08200	
08300		FOREACH X | FACE⊗X≡HIS DO J←0;
08400			COMMENT SINCE THIS REFERENCES THE LAS, THE
08500				ASSOCIATION FACE⊗BODY≡HIS WHICH WAS MADE
08600				IN THE LAS WILL BE RETRIEVED;
08700	
08800		FOREACH Y | GLOBAL  FACE ⊗ Y ≡ MINE DO J←1;
08900			COMMENT THIS REFERENCES THE GAS, AND SO Y WILL
09000				BE SATISFIED WITH  BODY.  NOTE THAT 
09100				Y NEED NOT BE A GLOBAL ITEMVAR IN ORDER
09200				TO CONTAIN A REFERENCE TO A GLOBAL ITEM;
09300	
09400		
09500	WARNING:
09600	
09700	1. You CANNOT put a triple containing a local item in the global store.
09800	
09900	2. A global item CANNOT have a local datum, and vica versa.
10000	
11100	
11200	The same datum conventions hold for array datums:
11300	
11400		GLOBAL INTEGER ARRAY ITEM AG[1:100];
11500	
11600		Z← GLOBAL DATUM (AG)[34];
11700	
11800	
11900	The GLOBAL versus non-global distinction is only necessary to resolve
12000	ambiguity.  Thus constructs like the following are  meaningless  (and
12100	hence of course, illegal):
12200	
12300		GLOBAL PUT FOO IN BLOBS;
12400		GLOBAL REMOVE JOBS FROM SYSTEM;
12500		GLOBAL Z ← Q;  COMMENT Q IS AN ITEM;
12600	
12700	On the other hand, the following is a list of the things where GLOBAL
12800	is needed if you intend to operate on the GAS:
12900	
13000		GLOBAL MAKE A⊗B≡C;
13100		GLOBAL ERASE A⊗B≡ANY;
13200		XX ← GLOBAL NEW (21.0);
13300		GLOBAL DELETE (XX);
13400		IF GLOBAL A⊗B≡C THEN TYPE "IT EXISTS" EOM;
13410		GLOBAL MAKE A⊗B≡GLOBAL NEW;
13420		GLOBAL MAKE A⊗[GLOBAL B⊗C≡D]≡E;
13500	

3600	Foreach searches also require the ambiguity between GAS and LAS to be
13700	resolved.   For  each association-referencing part of the associative
13800	context, you may need to say GLOBAL. For all  set-referencing  parts,
13900	no GLOBAL should be given:
14000	
14100		FOREACH X | GLOBAL A⊗B≡C ∧ X ε LOCALSET ∧
14200			X ε GLOBALSET DO AA←21;
14300	
14400	There is a syntactic ambiguity about the  use  of  the  word  GLOBAL.
14500	This  reserved  word may be used as part of a declaration, or as part
14600	of a statement.   Hence the construct BEGIN GLOBAL DATUM (x).... does
14700	not  parse  correctly. Instead, you must say BEGIN ; GLOBAL DATUM (x)
14800	....    This inconvenience  is  referred  to  affectionately  as  the
14900	Sproull hack. It deserves bitchy comments in your files when you have
15000	to get around it.
15100	
15200	We have added a boolean function to SAIL, called IFGLOBAL.  It  takes
15300	one  argument,  an  item (i.e. itemvar will also work).  The function
15400	returns true if the item was either declared GLOBAL or was created by
15500	a GLOBAL NEW.  It returns false otherwise.
15600	
15700	It  is  our intention to limit write access to the global model. This
15800	is generally called "model minding".  For the time being, access will
15900	be   unlimited,  and  we  will  rely  on  administration  to  prevent
16000	self-enclobberment. The following rumblings about model  minding  are
16100	preliminary and sketchy -- do not believe them too much.
16200	
16300	There  still  have  to  be  some decisions about model minding.  I am
16400	prepared to detect several  different  kinds  of  "writes"  into  the
16500	model:
16600		1. ordinary user writes -- e.g. integer variables,
16700			arrays, etc.
16800		2. set and itemvar stores.
16900		3. make and erase.
17000		4. put and remove.
17100		5. lop
17200	
17300	On all of these, I can provide the data which is about to be written,
17400	and  the  address of the global cell about to be stored into.  What I
17500	would suggest is that some subroutine (it would have  to  be  in  the
17600	second  segment as it now stands, although with the message procedure
17700	scheme, that could be changed) be called to establish access  to  the
17800	second segment.  In fact, perhaps the user should call it explicitly.
17900	This would grant access of the form <type (1-5  above)>,  <number  of
18000	accesses>.   We  could also make the access limited to certain global
18100	variables (although much harder).
18200	
18300	OK.  So what happens is this -- each  time  a  global  store  of  the
18400	variety 1-5 above happens either:
18500		a. we go ahead with it.  Some previous process of access has
18600			established write access for this guy.
18700		b. we call a specific one-time access checker, and proceed if
18800			he blesses us.
18900		c. we emit an error message if neither a or b happens.
19000			This error message could be in the form of
19100			a user subroutine which is activated when he faults.
19200	
19300	All of this still does not establish the criteria for the granting of
19400	access.
19500	
19600	
     

00100	3.0 SAILX -- THE LITTLE GAGLING
00200	
00300	One  of  the subjobs at your disposal is SAIL (remember the Armada?).
00400	This is no ordinary spokeshaver's SAIL, but a load-go compiler  which
00500	can  be used in a quasi-interactive way.  It gets its input from disk
00600	files or the teletype, compiles code into core, and  is  prepared  to
00700	execute that code.
00800	
00900	The virtues of this are several:
01000	1. This is an effective way of issuing  messages  to  modules.   This
01100	compiler will have the global definition tape pre-loaded into it, and
01200	will thus know about message procedures and global model names.
01300	
01400	2. This is a good way of examining  or  altering  the  global  model.
01500	There  will  be  some  routines for displaying sets, reals, integers,
01600	strings, associations, etc.  One can
01700	imagine writing a little "program":
01800	
01900		begin itemvar x,y;
02000		foreach x,y| global instance⊗cube≡x ∧ global edge⊗x≡y do
02100			show_item (y);
02200		end;
02300	
02400	3.  The  combination of the first two facilities give one the ability
02500	to write and try out  little  strategy  programs  at  an  interactive
02600	level.   We will provide a means of collecting the text that you type
02700	in.  Later on, you can go and make a real-live SAIL program from  the
02800	fragments of attempts made while on the system.
02900	
03000	SAILX  has  a method of compiling code for a block, executing it, and
03100	then throwing it away.  This is how the user (inelegantly)  specifies
03200	instantaneous  execution of his statements.  He must, of course, tell
03300	the compiler "this is the beginning of a block  to  be  executed  and
03400	then  discarded."  The  reserved  word  synonym  for that complicated
03500	sentence is EX.  Example:
03600	
03700		begin integer i,j,k;
03800		ex i←21; outstr (cvs(i)&'15&'12) end;
03900		ex i←31 end;
04000	
04100	The  "end"s  match  the  corresponding "ex"s. If you ever type an end
04200	which matches the original begin, the whole program (as it is at  the
04300	moment -- remember that ex .... end code was discarded) is executed.
04400	
04500	When you run SAILX, it may ask you for some information (see LOADING,
04600	below). Then it will type "list file?".  If you would like  a  record
04700	of  all your operations, then type a file name, otherwise <cr>.  Then
04800	it will say "input?".  Type a  device:filename,  or  simpley  device:
04900	(e.g.  TTY:).   When  end  of file is reached on that device, it will
05000	again ask you for an input source.  This allows you to load  up  lots
05100	of definitions and program (all except the final END) and then return
05200	to the TTY for EX operation.
05300	
05400	We proceed to give an example.  The text on the right is not typed at
05500	SAILX,  but  it  merely for commentary. Things typed out are in upper
05600	case; things typed in are in lower.
05700	
05800	
05900	
06000	.run dsk sailx[2,rfs]
06100	SEGMENT LOGICAL NAME?
06200	rfs
06300	SEGMENT FILE NAME
06400	glbseg
06500	DEVICE?
06600	sys
06700	LIST FILE?
06800	     <cr>
06900	INPUT?
07000	tty:
07100	begin "mypart of the hand-eye system"		
07200					Since the preamble file needs this
07300					"begin", we provide it now.
07400	require pnames;			We will need LEAP printnames.
07500	<c1><c2><lf>			This is end of file for the tty.
07600	INPUT?
07700	dsk:preamb[2,rfs]		Read in the preamble file.
07800	INPUT?
07900	tty:
08000	begin integer mess;
08100		ex			Start an executable block.
08200		mess←issue(7,"sailx","edge",message find(-1));
08300					Issue the message to Pingle's edge
08400					follower.  
08500		mess←get_entry('170,"edge","sailx","response");
08600					Wait for the response.
08700		end;			End of executable block. It will now
08800					go and execute the code.
08900	
09000	
09100	
09200	Eventually,  we  will  provide for SAILX some routines for displaying
09300	associations, sets, integers, reals, arrays, etc. This  should  allow
09400	you to look into the global model.
09500	
09600	
09700	
09800	An  important  historical note -- the load-and-go ability in SAIL was
09900	originally installed by D. Swinehart as a toy to try out some of  the
10000	methods  he  would  use  for  SLS  (the very last word in interactive
10100	debugging). The present SAILX differs from that toy only in that some
10200	syntax was installed to specify the range of execution and discarding
10300	and in that a few bugs were removed.
10400	
10500	
10600	
     

00100	4.0  LOADING
00200	
00300	The only phase of the magic that has not  been  covered  pertains  to
00400	actually  getting this whole amazing mass of code flying. The problem
00500	is to get all the modules loaded into core and talking to  the  right
00600	second segment.
00700	
00800	The first step in loading is to load your programs and link up to the
00900	right  segment.   The "dump" copies of the global segment are located
01000	on [1,3] and are available to the loader. You will need to  use  this
01100	command string to the loader when loading your files:
01200	
01300	GLBLOW[1,3],/Hxxxxxxxxxxxx
01400	
01500	Where the xxxxxxx represents your file name list. GLBLOW is the  name
01510	of  the  non-shared  part  of  SAIL's  runtime environment, specially
01520	tailored for the global model operation. It must be loaded first  and
01530	will link to the proper second segment after getting some information
01540	from you each time the program is started. First it will  ask  for  a
01550	logical  name.  If  it  can  attach to such a segment, it does so and
01560	bothers you no more. If not, it asks for a file name and a device  to
01570	use  as  a source of the global model.If you want the standard second
01580	segment, type carriage return for file name and device.